import Main from '@/views/Main.vue';
//登录
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: resolve => {
        require(['@/views/login.vue'], resolve);
    }
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [
        { path: 'home', title: '首页', name: 'home_index', component: resolve => { require(['@/views/home/home.vue'], resolve); } },
        { path: 'ownspace', title: '个人中心', name: 'ownspace_index', component: resolve => { require(['@/views/own-space/own-space.vue'], resolve); } },
        { path: 'message', title: '消息中心', name: 'message_index', component: resolve => { require(['@/views/message/message.vue'], resolve); } }
    ]
};
export const appRouter = [
    {
        path: '/ms',
        icon: 'key',
        name: 'ms',
        title: '权限管理',
        component: Main,
        children: [
            { path: 'index', title: 'xxx', name: 'index', component: resolve => { require(['@/views/ms/user.vue'], resolve); } },
            { path: 'index2', title: 'xxx2', name: 'ms_index2', component: resolve => { require(['@/views/ms/user.vue'], resolve); } },
        ]
    },
    {
        path: '/ms2',
        icon: 'key',
        name: 'ms2',
        title: '权限管理2',
        component: Main,
        children: [
            { path: 'index', title: 'xxx', name: 'index', component: resolve => { require(['@/views/ms/user.vue'], resolve); } },
            { path: 'index2', title: 'xxx2', name: 'ms_index2', component: resolve => { require(['@/views/ms/user.vue'], resolve); } },
        ]
    }

]
//404
export const page404 = {
    path: '/404',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: resolve => {
        require(['@/views/error-page/404.vue'], resolve);
    }
};
//403
export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error-403',
    component: resolve => {
        require(['@/views/error-page/403.vue'], resolve);
    }
};
//500
export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error-500',
    component: resolve => {
        require(['@/views/error-page/500.vue'], resolve);
    }
};

export const routers = [
    loginRouter,
    otherRouter,
    //...appRouter,
    page403,
    page500,
    page404
];
